package com.hanbang.maige.view.aboutme.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hanbang.maige.R;
import com.hanbang.maige.code.base.view.activity.BaseMvpActivity;
import com.hanbang.maige.mode.javabean.base.UserData;
import com.hanbang.maige.pressenter.aboutme.MyXiangCePresenter;
import com.hanbang.maige.utils.bitmap.GlideOptions;
import com.hanbang.maige.utils.bitmap.GlideUtils;
import com.hanbang.maige.view.aboutme.IAboutMeBaseView;
import com.hanbang.maige.widget.ScaleImageView;
import com.hanbang.maige.widget.autoloadding.SuperRecyclerView;

import butterknife.BindView;
import butterknife.ButterKnife;
import jp.wasabeef.glide.transformations.CropCircleTransformation;

import static com.hanbang.maige.code.MyApplication.myApp;
import static com.hanbang.maige.mode.javabean.base.UserData.userData;

/**
 * Created by 方朝辉 on 2016/11/3.
 */

public class MyXiangCeActivity extends BaseMvpActivity<IAboutMeBaseView.IMyXiangCeView, MyXiangCePresenter> implements IAboutMeBaseView.IMyXiangCeView {

    @BindView(R.id.touxiangBag)
    ScaleImageView touxiangBag;
    @BindView(R.id.headIv)
    ImageView headIv;
    @BindView(R.id.guanzhuTv)
    TextView guanzhuTv;
    @BindView(R.id.guanzhuLL)
    LinearLayout guanzhuLL;
    @BindView(R.id.fenshiTv)
    TextView fenshiTv;
    @BindView(R.id.fenshiLL)
    LinearLayout fenshiLL;
    @BindView(R.id.biaoqianTv)
    TextView biaoqianTv;
    @BindView(R.id.sixinLay)
    LinearLayout sixinLay;
    @BindView(R.id.guanzhuLay)
    LinearLayout guanzhuLay;
    @BindView(R.id.switchRoot)
    SuperRecyclerView switchRoot;

    @Override
    public MyXiangCePresenter initPressenter() {
        return new MyXiangCePresenter();
    }

    @Override
    public int getContentView() {
        return R.layout.activity_myxiangce;
    }

    public static void startUI(Context context) {
        Intent intent = new Intent(context, MyXiangCeActivity.class);
        context.startActivity(intent);
    }

    @Override
    public void initView() {
        guanzhuLay.setVisibility(View.VISIBLE);
        sixinLay.setVisibility(View.VISIBLE);
    }

    @Override
    public void parseIntent(Intent intent) {

    }

    @Override
    public void clearData() {

    }

    private void upStaticData() {
        if (UserData.getUserData() != null) {
            GlideUtils.show(headIv, userData.getHeadPhotoSma(), new GlideOptions.Builder()
                    .setPlaceholder1_1()
                    .addTransformation(new CropCircleTransformation(myApp))
                    .bulider());
            GlideUtils.show(touxiangBag, userData.getHeadPhotoMid(), new GlideOptions.Builder()
                    .bulider());

        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        upStaticData();
    }
}
